//数据类型验证
import {customeStruct} from '../utils';
const itf = customeStruct.interface;

export const InitData = itf({
    payload: itf({
        isDealerUser: 'boolean',
        company: itf({
            id: 'string',
            name: 'string',
            code: 'string',
        }),
        brands: [
            itf({
                id: 'string',
                code: 'string',
                name: 'string',
            })
        ]
    })
});

export const List = itf({
    payload: itf({
        content: [itf({
            id: 'string',
            brandCode: 'string',
            brandName: 'string',
            dealerCode: 'string',
            dealerName: 'string',
            code: 'string',
            orderPlanYear: 'number',
            orderPlanMonth: 'number',
            status: 'number',
            currency: 'number? | null',
            totalFee: 'number',
            createTime: 'string',
            rowVersion: 'string',
        })],
        totalElements: 'number',
    })
});

export const Detail = itf({
    payload: itf({
        id: 'string',
        dealerCode: 'string',
        dealerName: 'string',
        brandCode: 'string',
        country: 'string? | null',
        brandName: 'string',
        createTime: 'string',
        orderPlanYear: 'number',
        orderPlanMonth: 'number',
        currency: 'number? | null',
        totalFee: 'number',
        remark: 'string? | null',
        rowVersion: 'string',
        details: [itf({
            id: 'string',
            partId: 'string',
            partCode: 'string',
            partName: 'string',
        })]
    })
});

export const DealerList = itf({
    payload: itf({
        content: [itf({
            id: 'string',
            code: 'string',
            name: 'string',
            shortCode: 'string? | null',
            shortName: 'string? | null',
            countryName: 'string? | null',
            provinceName: 'string? | null',
            cityName: 'string? | null',
            contactPhone: 'string? | null',
            address: 'string? | null',
        })],
    })
});

export const MarketDepartmentList = itf({
    payload: [itf({
        id: 'string',
        code: 'string',
        name: 'string',
        isLeaf: 'boolean',
    })]
});

export const RegionList = itf({
    payload: itf({
        content: [itf({
            id: 'string',
            name: 'string',
        })],
    })
});

export const PartList = itf({
    payload: itf({
        content: [itf({
            id: 'string',
            code: 'string',
            name: 'string',
        })],
    })
});


export const HistoryList = itf({
    payload: itf({
        content: [itf({
            id: 'string',
            rowVersion: 'string',
        })],
    })
});

export const HistoryDetail = itf({
    payload: itf({
        id: 'string',
    })
});
